<?php
/**
 * Created by 784855684@qq.com.
 * Link: https://github.com/lichtung/wshore
 * User: linzh
 * Date: 7/8/17
 * Time: 10:27 AM
 */
declare(strict_types=1);


namespace application\module\admin\addon\wechat;

/**
 * Class WebAuth
 * 通过code换取网页授权access_token
 * @package application\module\admin\addon\wechat
 */
class WebAuth
{
    private $access_token = '';
    private $expires_in = '';
    private $refresh_token = '';
    private $openid = '';
    private $scope = '';

    public function __construct(array $data)
    {
        $this->access_token = $data['access_token'];
        $this->expires_in = $data['expires_in'];
        $this->refresh_token = $data['refresh_token'];
        $this->openid = $data['openid'];
        $this->scope = $data['scope'];
    }

    /**
     * @return string
     */
    public function getAccessToken(): string
    {
        return $this->access_token;
    }

    /**
     * @param string $access_token
     */
    public function setAccessToken(string $access_token)
    {
        $this->access_token = $access_token;
    }

    /**
     * @return string
     */
    public function getExpiresIn(): string
    {
        return $this->expires_in;
    }

    /**
     * @param string $expires_in
     */
    public function setExpiresIn(string $expires_in)
    {
        $this->expires_in = $expires_in;
    }

    /**
     * @return string
     */
    public function getRefreshToken(): string
    {
        return $this->refresh_token;
    }

    /**
     * @param string $refresh_token
     */
    public function setRefreshToken(string $refresh_token)
    {
        $this->refresh_token = $refresh_token;
    }

    /**
     * @return string
     */
    public function getOpenid(): string
    {
        return $this->openid;
    }

    /**
     * @param string $openid
     */
    public function setOpenid(string $openid)
    {
        $this->openid = $openid;
    }

    /**
     * @return string
     */
    public function getScope(): string
    {
        return $this->scope;
    }

    /**
     * @param string $scope
     */
    public function setScope(string $scope)
    {
        $this->scope = $scope;
    }
}